/*
 * @Author       :
 * @Date         : 2022-02-08 22:07:44
 * @LastEditors  : Please set LastEditors
 * @LastEditTime : 2022-02-19 16:31:59
 * @Description  : 快捷访问
 */

import { genderateColor } from '@/utils/theme'
import { getItem } from '@/utils/storage'
import { MAIN_COLOR } from '@/constant'

const getters = {
  token: state => state.user.token,
  hasUserInfo: state => {
    return JSON.stringify(state.userInfo) !== '{}'
  },
  userInfo: state => {
    return {
      avatar: 'https://static.vue-js.com/6280b990-ff19-11ea-85f6-6fac77c0c9b3.png'
    }
  },
  cssVar: state => ({ ...state.theme.variables, ...genderateColor(getItem(MAIN_COLOR)) }),
  sidebarOpen: state => state.app.sidebarOpen,
  language: state => state.app.language,
  mainColor: state => state.theme.mainColor
}

export default getters
